home *** CD-ROM | disk | FTP | other *** search
- Path: svnews.ubinet.ubs.com!ubszh!ubszh!jis
- From: jis@ubszh.net.ch (Johnston Ian (by ubsswop))
- Newsgroups: comp.lang.c++
- Subject: Re: maddening constructor problem
- Date: 22 Jan 1996 10:31:43 GMT
- Organization: UBS
- Distribution: world
- Message-ID: <4dvp2f$rbd@ubszh.fh.zh.ubs.com>
- References: <4dr307$4so@noc2.drexel.edu>
- NNTP-Posting-Host: nol2179.fh.zh.ubs.com
-
- In article <4dr307$4so@noc2.drexel.edu>, st918h5w@dunx1.ocs.drexel.edu (Jonathan Juniman) writes:
- |> Maddening constructor problem:
- |>
- |> MYCLASS.H
- |> class MyClass
- |> {
- |> public:
- |> MyClass(unsigned int i, insigned int j, double* pK);
- |> // etc
- |> }
- |>
- |> MYCLASS.CPP
- |> MyClass::MyClass(unsigned int i, unsigned int j, double* pK)
- |> {
- |> // constructor code here
- |> }
- |>
- |> Visual C++ bites me on MYCLASS.CPP, saying "constructor not allowed
- |> a return type". What's the problem? The constructor doesn't _have_
- |> a return type. Please respond by e-mail.
-
- Almost certainly a missing semi-colon on a class or struct declaration
- immediately preceding the constructor (*after* preprocessing).
-
- For example:
-
- struct X
- {
- X();
- }
-
- X::X()
- {
- }
-
-
- Without the semi-colon, the compiler sees the struct declaration as the
- return type.
-
- Ian
-
-
-